﻿using System.Collections.Generic;


namespace Less.Tools
{
    public class Cache
    {
        private static readonly Cache _container = new Cache();
        public static Cache Container { get { return _container; } }
        
        private Cache()
        {
        }

        public Dictionary<string,object> Dictionary { get; set; }

        public void Set(string key, object value)
        {
            if(Dictionary==null) Dictionary = new Dictionary<string, object>();
            if ( Dictionary.ContainsKey(key) )
                Dictionary[key] = value;
            else
                Dictionary.Add(key,value);
        }

        public object Get(string key)
        {
            if ( Dictionary == null ) return null;
            if ( Dictionary.ContainsKey(key) )
                return Dictionary[key];
            else 
                return null;
        }
    }
}
